﻿using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[ExecuteInEditMode]
public class SlotMarker : MonoBehaviour
{
    public Image border;
    public Image bg;
    public GameObject currentText;

    public bool isSet = false;
    public bool isCurrent = false;
    public bool isChange = true;

    public void SetMarkerStatus(bool isSet, bool isCurrent)
    {
        isChange = false;

        border.color = isSet ? new Color(.74f, .38f, .07f, 1f) : Color.white;
        bg.color = isSet ? new Color(1, .65f, 0, 1) : Color.clear;
            
        currentText.transform.localScale = isCurrent && isSet ? Vector3.one : Vector3.zero;
    }
    
    private void Update()
    {
        if (isChange)
        {
            SetMarkerStatus(this.isSet, this.isCurrent);
            isChange = false;
        }
    }
}
